from django.contrib import admin

from user.models import LoginLog, User, Category, Article, Comment


class UserModelAdmin(admin.ModelAdmin):
    list_display = ('nickname', 'email', 'tel', 'locked', 'regdate', 'credit')
    list_per_page = 20
    ordering = ('userid', )


class LoginLogModelAdmin(admin.ModelAdmin):
    list_display = ('userid', 'ipaddr', 'logdate')
    list_per_page = 50
    ordering = ('logid', )


class CategoryModelAdmin(admin.ModelAdmin):
    list_display = ('name', 'memo', 'total')
    ordering = ('cateid', )


class ArticleModelAdmin(admin.ModelAdmin):
    list_display = ('userid', 'title', 'pubdate', 'lastdate', 'deleted', 'withdrawn', 'read', 'good')
    list_per_page = 10
    ordering = ('artid', )


class CommentModelAdmin(admin.ModelAdmin):
    list_display = ('content', 'godlike', 'deleted', 'withdrawn', 'good', 'bad')
    ordering = ('comid', )


admin.site.register(User, UserModelAdmin)
admin.site.register(LoginLog, LoginLogModelAdmin)
admin.site.register(Category, CategoryModelAdmin)
admin.site.register(Article, ArticleModelAdmin)
admin.site.register(Comment, CommentModelAdmin)
